﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UITestingBaseClass.cs" company="">
// </copyright>
// <summary>
//   The ui testing base class.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace UITest.CuitTestProject
{
    using System.IO;

    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using UITest.CUIT.CuitContext;
    using UITest.CUIT.CuitControls;

    /// <summary>
    ///     The ui testing base class.
    /// </summary>
    [CodedUITest]
    [DeploymentItem(@"Sample\TestHtmlPage.html")]
    public class UITestingBaseClass
    {
        #region Fields

        /// <summary>
        /// The current directory.
        /// </summary>
        protected readonly string CurrentDirectory = Directory.GetCurrentDirectory();

        /// <summary>
        ///     The selenium.
        /// </summary>
        protected CuitContext CuitContext;

        #endregion

        #region Public Methods and Operators

        /// <summary>
        ///     The my test initialize.
        /// </summary>
        [TestInitialize]
        public void MyTestInitialize()
        {
            
            CuitContextFactory.New();
            this.CuitContext = CuitContextFactory.GetCuitContext();
        }

        #endregion

        ////Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup()
        // {        
        // // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        // }

        protected void LaunchTestingPage()
        {
            
            this.UITestHtmlPage.browserWindow.StartBrowser(
                Browsers.iexplore,
                this.CurrentDirectory + "/TestHtmlPage.html");
            
        }

        protected readonly UITestHtmlPage UITestHtmlPage = new UITestHtmlPage();
    }
}